# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contrinutor: shining <shiningxc@gmail.com>
# Contributor: phillid <dbphillipsnz _at_thingy_that_swirly_a_symbol gmaildott comm>

pkgname=python-pydot
pkgver=1.4.2
pkgrel=4
pkgdesc="Python interface to Graphviz's Dot"
arch=('any')
url="https://github.com/erocarrera/pydot"
license=('MIT')
depends=('python-pyparsing' 'graphviz')
makedepends=('python-setuptools')
checkdepends=('python-chardet')
source=("$pkgname-$pkgver.tar.gz::https://github.com/erocarrera/pydot/archive/v$pkgver.tar.gz")
sha512sums=('caa8051561710129b5164fd1392da941829fd977092a6ec8b00efe7a199d2d60bc7ef13cb0e51615f384550f0fb80190d0f56b83d8d80d1fe372efb5dbbd3632')

build() {
  cd pydot-$pkgver
  python setup.py build
}

check() {
  # https://github.com/pydot/pydot/issues/204

  cd "$srcdir"/pydot-$pkgver/test
  PYTHONPATH="$PWD/../build/lib:$PYTHONPATH" python pydot_unittest.py || echo "Tests failed"
}

package() {
  cd pydot-$pkgver
  python setup.py install -O1 --root="$pkgdir"
  install -D -m644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
